package thesis.filesharing.model;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;

import com.google.appengine.api.datastore.Key;
import com.google.appengine.datanucleus.annotations.Unowned;

@Entity
public class Student {
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Key studentKey;
	
	@Basic
	private String studentId;
	
	@Basic
	private String studentName;
	
	@Basic
	private String studentEmail;
	
	@Basic
	private String className;
	
	@Basic
	private Integer course;
	
	@Basic
	private String studentPassword;
	
	@Basic
	private boolean isActive;
	
	@Basic
	private Set<String> roles = new HashSet<String>();
	
	@Basic(fetch = FetchType.EAGER)
	private Set<Key> classKeys = new HashSet<Key>();
	
	@Basic
	private Set<Key> groupKeys = new HashSet<Key>();
	
	@Unowned
	@OneToMany
	private Set<Group> leadGroups = new HashSet<Group>();
	
	@Unowned
	@OneToMany(fetch = FetchType.LAZY)
	private Set<ExerciseFile> exerciseFiles = new HashSet<ExerciseFile>();
	
	public Student() {
		
	}

	public Student(String studentId, String studentName, String studentEmail,
			String className, Integer course, String studentPassword, boolean isActive) {
		this.studentId = studentId;
		this.studentName = studentName;
		this.studentEmail = studentEmail;
		this.className = className;
		this.course = course;
		this.studentPassword = studentPassword;
		this.isActive = isActive;
	}
	
	public Student(Key studentKey, String studentId, String studentName,
			String studentEmail, String className, Integer course,
			String studentPassword, boolean isActive, Set<String> roles) {
		this.studentKey = studentKey;
		this.studentId = studentId;
		this.studentName = studentName;
		this.studentEmail = studentEmail;
		this.className = className;
		this.course = course;
		this.studentPassword = studentPassword;
		this.isActive = isActive;
		this.roles = roles;
	}

	public Student(Key studentKey, String studentId, String studentName,
			String studentEmail, String className, Integer course,
			String studentPassword, boolean isActive, Set<String> roles,
			Set<Key> classKeys) {
		this.studentKey = studentKey;
		this.studentId = studentId;
		this.studentName = studentName;
		this.studentEmail = studentEmail;
		this.className = className;
		this.course = course;
		this.studentPassword = studentPassword;
		this.isActive = isActive;
		this.roles = roles;
		this.classKeys = classKeys;
	}

	public Student(Key studentKey, String studentId, String studentName,
			String studentEmail, String className, Integer course,
			String studentPassword, boolean isActive, Set<String> roles,
			Set<Key> classKeys, Set<Key> groupKeys, Set<Group> leadGroups) {
		this.studentKey = studentKey;
		this.studentId = studentId;
		this.studentName = studentName;
		this.studentEmail = studentEmail;
		this.className = className;
		this.course = course;
		this.studentPassword = studentPassword;
		this.isActive = isActive;
		this.roles = roles;
		this.classKeys = classKeys;
		this.groupKeys = groupKeys;
		this.leadGroups = leadGroups;
	}

	public Student(String studentId, String studentName, String studentEmail,
			String className, Integer course, String studentPassword,
			boolean isActive, Set<String> roles, Set<Key> classKeys,
			Set<Key> groupKeys, Set<Group> leadGroups,
			Set<ExerciseFile> exerciseFiles) {
		this.studentId = studentId;
		this.studentName = studentName;
		this.studentEmail = studentEmail;
		this.className = className;
		this.course = course;
		this.studentPassword = studentPassword;
		this.isActive = isActive;
		this.roles = roles;
		this.classKeys = classKeys;
		this.groupKeys = groupKeys;
		this.leadGroups = leadGroups;
		this.exerciseFiles = exerciseFiles;
	}

	public Student(String studentId, String studentName, String studentEmail,
			String className, Integer course, String studentPassword, boolean isActive, Set<String> roles) {
		this(studentId, studentName, studentEmail, className, course, studentPassword, isActive);
		this.roles = roles;
	}

	public String getStudentId() {
		return studentId;
	}

	public void setStudentId(String studentId) {
		this.studentId = studentId;
	}

	public String getStudentEmail() {
		return studentEmail;
	}

	public void setStudentEmail(String studentEmail) {
		this.studentEmail = studentEmail;
	}

	public Integer getCourse() {
		return course;
	}

	public void setCourse(Integer course) {
		this.course = course;
	}

	public String getStudentName() {
		return studentName;
	}

	public void setStudentName(String studentName) {
		this.studentName = studentName;
	}

	public String getClassName() {
		return className;
	}

	public void setClassName(String className) {
		this.className = className;
	}

	public Set<String> getRoles() {
		return roles;
	}

	public void setRoles(Set<String> roles) {
		this.roles = roles;
	}

	public String getStudentPassword() {
		return studentPassword;
	}

	public void setStudentPassword(String studentPassword) {
		this.studentPassword = studentPassword;
	}

	public Set<Key> getClassKeys() {
		return classKeys;
	}

	public void setClassKeys(Set<Key> classKeys) {
		this.classKeys = classKeys;
	}

	public boolean isActive() {
		return isActive;
	}

	public void setActive(boolean isActive) {
		this.isActive = isActive;
	}
	
	public Key getStudentKey() {
		return studentKey;
	}
	
	public void setStudentKey(Key studentKey) {
		this.studentKey = studentKey;
	}

	public Set<Key> getGroupKeys() {
		return groupKeys;
	}

	public void setGroupKeys(Set<Key> groupKeys) {
		this.groupKeys = groupKeys;
	}

	public Set<Group> getLeadGroups() {
		return leadGroups;
	}

	public void setLeadGroups(Set<Group> leadGroups) {
		this.leadGroups = leadGroups;
	}

	public Set<ExerciseFile> getExerciseFiles() {
		return exerciseFiles;
	}

	public void setExerciseFiles(Set<ExerciseFile> exerciseFiles) {
		this.exerciseFiles = exerciseFiles;
	}
}
